#!/usr/bin/env python

import os

if os.path.islink(__file__):
    setupdazhu_path = os.readlink(__file__)
else:
    setupdazhu_path = __file__
setupdazhu_name = os.path.basename(setupdazhu_path)

if setupdazhu_name != "setupdazhu":
    print "The original script must named setupdazhu"
    exit(1)

dazhu_path = os.path.dirname(setupdazhu_path)
dazhu_name = os.path.basename(dazhu_path)

if dazhu_name != "dazhu":
    print "The original script must in dazhu dir"
    exit(1)

os.system("cp -frvaL '%s' ." % dazhu_path)
os.system("chmod a+x dazhu -R")

fmt_red = "\033[1;31m%s\033[0m"
fmt_yellow = "\033[1;33m%s\033[0m"

print
print "+++++++++++++++++++++++++++++ DONE +++++++++++++++++++++++++++++"
print
print
print
print "++++++++++++++++++++++++ WHAT ARE NEXT +++++++++++++++++++++++++"
print
print "Please run " + (fmt_yellow % "`ln -s dazhu/m m.<BUILD_TYPE>.<CONFIG_TYPE>`") + " to create the BKM make file"
print "E.g.:"
print fmt_red % "ln -s dazhu/m m.bld.tbc_phase1"
print fmt_red % "ln -s dazhu/m m.relase.tbc_phase1"

